Add cartoepxplorer option to pcx so we don't write track names that blow it away.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 9 Nov 2005 21:56:26 +0000 (21:56 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 9 Nov 2005 21:56:26 +0000 (21:56 +0000)
gpsbabel/pcx.c

index c42f9adac0b2e1466b51d944ac032a6cc41482a8..ede52a006d05a6bc71e652da8382f3e53d0f2d9c 100644 (file)
@@ -29,6 +29,7 @@ static FILE *file_out;
 static short_handle mkshort_handle;
 static short_handle mkshort_handle2;   /* for track and route names */
 static char *deficon = NULL;
+static char *cartoexplorer;
 static int read_as_degrees;
 static int route_ctr;
 
@@ -38,6 +39,9 @@ static
 arglist_t pcx_args[] = {
        {"deficon", &deficon, "Default icon name", "Waypoint", 
                ARGTYPE_STRING },
+       {"cartoexplorer", &cartoexplorer,
+               "Write tracks compatible with CartoExploreror", "",
+               ARGTYPE_STRING },
        {0, 0, 0, 0, 0}
 };
 
@@ -227,9 +231,13 @@ gpsutil_disp(const waypoint *wpt)
                tp++;
        }
 
-       icon_token = mps_find_icon_number_from_desc(wpt->icon_descr, PCX);
-       if (get_cache_icon(wpt)) {
-               icon_token = mps_find_icon_number_from_desc(get_cache_icon(wpt), PCX);
+       if (deficon) {
+               icon_token = atoi(deficon);
+       } else {
+               icon_token = mps_find_icon_number_from_desc(wpt->icon_descr, PCX);
+               if (get_cache_icon(wpt)) {
+                       icon_token = mps_find_icon_number_from_desc(get_cache_icon(wpt), PCX);
+               }
        }
 
 
@@ -258,7 +266,12 @@ pcx_track_hdr(const route_head *trk)
        snprintf(buff, sizeof(buff)-1, "Trk%03d", route_ctr);
        
        name = mkshort(mkshort_handle2, (trk->rte_name != NULL) ? trk->rte_name : buff);
-       fprintf(file_out, "\n\nH  TN %s\n", name);
+       /* Cartoexplorer (popular in France) chokes on trackname headers,
+        * so provide option to supppress these.
+        */
+       if (!cartoexplorer) {
+               fprintf(file_out, "\n\nH  TN %s\n", name);
+       }
        fprintf(file_out, "H  LATITUDE    LONGITUDE    DATE      TIME     ALT  ;track\n");
 
 }